package com.emergency.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 消息指令类
 * */
@Entity
@Table(name="bus_message")
public class Message extends BaseEntity{

    /**文书主题*/
    private String subject;
    /**文书内容*/
    private String content;
    /**发送方*/
    private String sendUser;
    /**接收方*/
    private String receiveUser;
    /**文书类型，1一般文书，2重要文书*/
    private int type;
    /**文书状态，1未发送，2执行中，3执行结束*/
    private int status;
    /**发送时间*/
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date sendTime;
    /**文书是否删除 0未删除，1删除进入回收站*/
    private int isDelete;

    /**想定*/
    @OneToOne(targetEntity=Scenar.class,fetch= FetchType.LAZY)
    @JoinColumn(name="scenar_id",referencedColumnName="id")
    private Scenar scenar;

    //所属分队
    @OneToOne(targetEntity=Army.class,fetch= FetchType.LAZY)
    @JoinColumn(name="army_id",referencedColumnName="id")
    private Army army;

    //指令计划
    @OneToOne(targetEntity=PlanDetail.class,fetch= FetchType.LAZY)
    @JoinColumn(name="plan_detail_id",referencedColumnName="id")
    private PlanDetail planDetail;

    /**临时属性*/
    @Transient
    private List<File> attachments;


    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getSendUser() {
        return sendUser;
    }

    public void setSendUser(String sendUser) {
        this.sendUser = sendUser;
    }

    public String getReceiveUser() {
        return receiveUser;
    }

    public void setReceiveUser(String receiveUser) {
        this.receiveUser = receiveUser;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Date getSendTime() {
        return sendTime;
    }

    public void setSendTime(Date sendTime) {
        this.sendTime = sendTime;
    }

    public int getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(int isDelete) {
        this.isDelete = isDelete;
    }

    public List<File> getAttachments() {
        return attachments;
    }

    public void setAttachments(List<File> attachments) {
        this.attachments = attachments;
    }

    public Army getArmy() {
        return army;
    }

    public void setArmy(Army army) {
        this.army = army;
    }

    public PlanDetail getPlanDetail() {
        return planDetail;
    }

    public void setPlanDetail(PlanDetail planDetail) {
        this.planDetail = planDetail;
    }

    public void setScenar(Scenar scenar) {
        this.scenar = scenar;
    }

    public Scenar getScenar() {
        return scenar;
    }
}
